<?php

/**
 * artikel form base class.
 *
 * @method artikel getObject() Returns the current form's model object
 *
 * @package    pendidikan indonesia
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseartikelForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'              => new sfWidgetFormInputHidden(),
      'judul'           => new sfWidgetFormInputText(),
      'isi'             => new sfWidgetFormInputText(),
      'id_penulis'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('user'), 'add_empty' => false)),
      'id_bidang_studi' => new sfWidgetFormInputText(),
      'created_at'      => new sfWidgetFormDateTime(),
      'updated_at'      => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'              => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'judul'           => new sfValidatorString(array('max_length' => 255)),
      'isi'             => new sfValidatorPass(),
      'id_penulis'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('user'))),
      'id_bidang_studi' => new sfValidatorInteger(),
      'created_at'      => new sfValidatorDateTime(),
      'updated_at'      => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('artikel[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'artikel';
  }

}
